package com.shushan.mixedexam.oralcalculation.bean;

import com.android.net.bean.NetBaseBean;
import com.shushan.base.Constants;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @ClassName: OCExerciseResultBean
 * @Desciption: //口算练习结果数据bean
 * @author: zhangshihao
 * @date: 2018-08-15
 */
public class OCExerciseResultBean extends NetBaseBean {

    public String id;
    public int score;
    public String reward_name;
    public String reward_description;
    public int reward_time;
    public int stars_num;
    public int error_count;
    public int right_count;
    public String more_practice;
    public int paper_id;
    public String first_toy;

    public int total;
    public int num;
    public int time;

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        if(jsonObject == null){
            return;
        }
        id = jsonObject.optString("id","");
        score = jsonObject.optInt(Constants.SUBJECT_MACH_ID+"",0);
        reward_name = jsonObject.optString("reward_name","");
        reward_description = jsonObject.optString("reward_description","");
        reward_time = jsonObject.optInt("reward_time",0);
        stars_num = jsonObject.optInt("stars_num",0);
        error_count = jsonObject.optInt("error_count",0);
        right_count = jsonObject.optInt("right_count",0);
        more_practice = jsonObject.optString("more_practice","");
        paper_id = jsonObject.optInt("paper_id",0);
        first_toy = jsonObject.optString("first_toy","");

        JSONObject rewardObj = jsonObject.optJSONObject("reward_setting");
        if(rewardObj != null){
            total = rewardObj.optInt("total",0);
            num = rewardObj.optInt("num",0);
            time = rewardObj.optInt("time",0);
        }
    }
}
